package sistemioperativi.matrice.es2;

public class ScannerRighe extends Thread {

			private int[][] matrix;
			private int rigaAssegnata;
			private int cordColonna = -1;
			
	public ScannerRighe(int[][] matrix, int rigaAssegnata){
		
		this.matrix = matrix;
		this.rigaAssegnata = rigaAssegnata;
	
	}

	
	public boolean ready(){
		if (this.getColonna() != -1)
			return true;
					return false;
	}
	
	public int getColonna(){
		try{
			return this.cordColonna;
		}catch(Exception e){}
		return -1;
	}
	public int[] getCordMaxRighe(){
		
		try{
			
		join();
		int[] a = new int[2];
		a[0] = this.rigaAssegnata;
		a[1] = this.cordColonna;
	
		return a;
	}catch(Exception e){};
	
		return null;
	}
	
	public void run(){
		//ricerco il massimo della mia riga.
		
		
		int max = Integer.MIN_VALUE;
		
		for(int j = 0; j<matrix[rigaAssegnata].length; j++){
			if(this.matrix[rigaAssegnata][j] > max){
				max = matrix[rigaAssegnata][j];
				cordColonna = j;
			}	
		}
		
		
		
	}
	
}


